import glob

def extract():
	allfiles = glob.glob("*.txt")
	allfiles.sort()
	sentences = []
	for file in allfiles:
		lines = open(file).readlines()
		for line in lines:
			line = line.strip()
			if " it " in line or " its " in line or " itself " in line or "It " in line or "Its " in line:
				sentences.append(line)
		sentences.append("\n")
	
	f = open ("it.txt", 'w')
	for sentence in sentences:
		f.write(sentence)
	f.close()

extract()
